//
//  fenLeiDetialPriceTableViewCell.m
//  Experss
//
//  Created by Chen on 2017/8/3.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "fenLeiDetialPriceTableViewCell.h"

@interface fenLeiDetialPriceTableViewCell ()<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *minTF;

@property (weak, nonatomic) IBOutlet UITextField *maxTF;

@end

@implementation fenLeiDetialPriceTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.minTF.layer.cornerRadius = 5;
    
    self.minTF.clipsToBounds = YES;
    
    self.minTF.delegate = self;
    
    self.maxTF.layer.cornerRadius = 5;
    
    self.maxTF.clipsToBounds = YES;
    
    self.maxTF.delegate = self;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChange:) name:UITextFieldTextDidChangeNotification object:self.minTF];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textChange:) name:UITextFieldTextDidChangeNotification object:self.maxTF];
}

- (void)textChange:(NSNotification *)noti{
    
    UITextField *tf = (UITextField *)noti.object;
    
    if (tf == self.minTF) {
        self.model.minprice = self.minTF.text;
    } else {
        self.model.maxprice = self.maxTF.text;
    }
    
}

- (void)setModel:(FenleiShaixuanModel *)model{
    _model = model;
    
    self.minTF.text = model.minprice;
    
    self.maxTF.text = model.maxprice;
    
}

-(void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
